# Program variables (DON'T DELETE!!!)
block_speed = -6 # controls how fast the pipes move across the stage
block_gap = 200 # controls the space between the top and bottom of each pipe
block_interval = 1 # controls how often a new pipe appears
gravity = 10 # controls how fast the sprite falls
flappiness = 5 # controls how much the sprite moves up
# Store and display score
score = 0
score_text = codesters.Text("Score: " + str(score), 100, 200, "yellow")
########################################################################
# ADD CODE BELOW THIS LINE #
########################################################################
stage.set_background("space")
stage.disable_all_walls()
sprite = codesters.Sprite("dinosaur")
t = codesters.Teacher()
set_sizes = t.find_function("set_size")
set_say_color = t.find_function("set_say_color")
try:
tval2 = set_sizes[0][1].lower().replace(' ','')
except:
tval2 = "DNE"
try:
tval3 = set_say_color[0][1].lower().replace(' ','')
except:
tval3 = "DNE"
t2 = TestObjective()
t2.add_success('.4)' in tval2, "Great job!")
t2.add_failure(tval2 == "DNE", "Did you add Set Size to the program?")
t2.add_failure(tval2 != "DNE" and '.4)' not in tval2, "Did you change the number in .set_size() from 0.5 to 0.4?")
t3 = TestObjective()
t3.add_success('("yellow")' in tval3, "Great job!")
t3.add_failure(tval3 == "DNE", "Did you add Set Say Color to the program?")
t3.add_creative(tval3 != "DNE" and '("yellow")' not in tval3 and '("blue")' not in tval3, "Nice! That's a great color too.?")
tester = TestManager()
tester.add_test_list([t2, t3])
tester.run_tests()
tester.display_first_feedback()
-
Run Code
-
Activity Submitted!
Submit Work
-
Next Activity
-
Stop Running Code
-
Show Chart
-
Show Console
-
Reset Code Editor
-
Codesters How To (opens in a new tab)